package ru.papergames.battleserver.model;

import ru.papergames.battleserver.model.battle.AbstractBattle;
import ru.papergames.battleserver.model.battle.BattlePlayer;
import ru.papergames.battleserver.model.battle.npc.processors.NpcActionProcessor;
import ru.papergames.battleserver.network.serverpackets.flashuser.PaperGameServerPacket;
import ru.papergames.common.form.AbstractPlayerForm;

/**
 * @author Alexander Troshanin
 */
public abstract class AbstractPaperGameUser<T extends AbstractPlayerForm> {

    private T player;

    private AbstractBattle battle;
    private BattlePlayer battleMember;
    private int teamId;

    public AbstractPaperGameUser(T player) {
        this.player = player;
    }

    public T getPlayer() {
        return player;
    }

    public long getId() {
        return player.getId();
    }

    public AbstractBattle getBattle() {
        return battle;
    }

    public void setBattle(AbstractBattle battle) {
        this.battle = battle;
    }

    public BattlePlayer getBattleMember() {
        return battleMember;
    }

    public void setBattleMember(BattlePlayer battleMember) {
        this.battleMember = battleMember;
    }

    public int getTeamId() {
        return teamId;
    }

    public void setTeamId(int teamId) {
        this.teamId = teamId;
    }

    public abstract void sendPacket(PaperGameServerPacket packet);

    public abstract void disconnect(PaperGameServerPacket msg);

    public abstract boolean isInBattle();

    public abstract void setInBattleState();

    public abstract void setNormalState();

    public abstract boolean isDetached();

    public abstract boolean checkPingTimeout(long timeout);

    public abstract long getPingTimeout();

    public abstract NpcActionProcessor getActionProcessor();
}
